package com.kefu.call.vo;

import com.kefu.call.model.ContactPlan;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractUpdateVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;

/**
 * @author francis
 * @date 2021/05/22
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "联系计划")
public class ContactPlanUpdateVo extends AbstractUpdateVo<ContactPlan,String> {
    /**
     * 主键
     */
	@NotEmpty
    @ApiModelProperty(name = "planId", value = "主键")
    private String planId;
    /**
     * 计划状态
     */
    @ApiModelProperty(name = "planStatus", value = "计划状态",example="1",allowableValues="1,2",notes="1=处理中，2=处理完成")
    private Integer planStatus;
    /**
     * 通话ID
     */
    @ApiModelProperty(name = "callId", value = "通话ID")
    private String callId;
    /**
     * 计划备注
     */
    @Size(max = 200)
    @ApiModelProperty(name = "planDesp", value = "计划备注")
    private String planDesp;

    @Override
    public ContactPlan convert() {
        ContactPlan info = new ContactPlan();
        info.setPlanStatus(planStatus);
        info.setPlanDesp(planDesp);
        KefuContext context = KefuContext.getKefuContext();
        info.setPlanId(planId);
        info.setUpdateTime(context.getNow());
        info.setUpdateUser(context.getUserId());
        return info;
	}
}